Repository navigation
test(cleanup): calibrate S1-mini stylings across general and email layouts - #283
Merged
Merged
Conversation
The prompt pinned [Context: general]. Calibration needs to request the model's trained email layout. An optional context field on the S1 style does that; every app caller omits it and still sends general with the same prompt bytes. Part of #281
…youts The sweep now runs every fixture under each Styling tag and both Context values, and records one row per fixture, styling and context with its latency. New synthetic fixtures cover chat lines, a work message, emails with greeting and sign-off, one-line email replies, endings that stress a final-period rule, and a long email that spans two cleanup chunks. Part of #281
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #281
Why
Per-app Style maps three product styles (Formal, Casual, Very casual) and an email layout onto S1-mini's trained
StylingandContexttags. Nobody had measured what each tag really produces, so the mapping and the card copy would have been guesses. The calibration script swept only the four Styling tags, and the prompt pinned[Context: general].This PR makes the sweep cover 4 Styling tags × 2 Context values, adds the fixtures the decisions need, and records what the real model returned. The tables and decisions below are the deliverable.
Scope
prompt.ts:CleanupStylegains an optionalcontext(generaloremail). Every app caller omits it, so the prompt bytes stay the same. The existing exact-bytes test proves that, and a new test checks the email control line.calibrate.mts: sweeps each fixture under every styling and context. It records one JSONL row per fixture, styling and context, with that call's latency and every chunk the model returned. It then replays the plausibility guard over the rows as before. Old recordings do not load.dictations.json: 19 new synthetic fixtures (chat lines, work messages, emails with greeting and sign-off, one-line replies, endings, names with acronyms, notes). A generatedlong-emailof 432 words spans two 400-token chunks.The recording is not committed.
Findings
Model
s1-mini-q4_k_m.gguf. 121 fixtures × 8 = 968 rows, 1008 chunks, 77 rejected by the guard. Percentages count accepted rows over all fixtures, including the old ones..Casual's base tag:
semi-formalsemi-casualis not "Caps". It lowercases sentence starts and only capitalizesI, names and acronyms. Rows start uppercase 12% of the time against 93% forsemi-formal.chat-coming-tonight, semi-casual:hey, are you coming tonight? um I was thinking we could grab pizza first. let me know.work-status-update, semi-casual:hey team, quick update. um the API migration is done, and I deployed it to staging this morning. can someone review the PR before Friday?semi-casualalso keeps fillers. Spokenum/uhsurvived in 8 of 11 rows that had them, against 0 of 10 forsemi-formal(chat-coming-tonight,work-status-update,email-deck). It already drops the final period (0% end with.).semi-formalplus "drop one final period" gives caps, full inner punctuation, no fillers, and no meaning change. Example fromchat-lunch:Hey, are you free for lunch tomorrow? Let's do 12 if that works for you.Migration note for PR 2. Users on
semi-casualwho move to Casual will start seeing sentence caps and filler removal.Very casual = S1
casualasr-possessiveLet's meet at John's place.→lets meet at johns place, andasr-cant-wont→i cant make it and i wont be there.names-github-api→can you ask kenji to push the fix to github before the api review with nasa?. Only dictionary rewrites, which run after cleanup, can restore taught casing..(0%). Questions keep?(9 of 9).fillers-mixed→um so basically the thing is ..., andchat-coming-tonight→... tonight? um i was thinking ....The card rule "No caps, no period at the end" is accurate. The example should show the missing apostrophes, because that is what users get.
Email layout: ship, gated to 10 words or more
With
[Context: email], a dictated greeting, body and sign-off comes out as an email undersemi-formalandformal.email-decksemi-formal email:Hi Maria,⏎⏎Thanks for sending the deck. ... which I will send over tomorrow.⏎⏎Best,⏎Mateusz.casualandsemi-casualbreak after the greeting, but the sign-off stays on one line:...tomorrow⏎⏎best mateusz.Any message that opens with a greeting gets the greeting line under every styling:
chat-lunch→Hey,⏎⏎Are you free .... In the Email category that is the point.One-line replies mostly stay alone, but not reliably:
sounds good see you thenandsure i attached the updated contract ...are unchanged under all four stylings.thanks that works for me→Thanks,⏎⏎That works for me.under semi-formal and semi-casual. That is invented structure.thanks→Thanks,under all four stylings.alright see you then→See you then.under semi-formal. The guard rejected it, so raw text would be inserted.um uh so like um you know uh→So, like,under semi-formal email, accepted. General gives an empty output.Every regression above came from an input of 8 words or fewer. Every English fixture of 10 words or more that changed under email got a greeting line, paragraph breaks, or small punctuation and casing changes. The one exception is
chat-running-late(14 words). Semi-formal email dropped "so", and the guard rejected it. The guard rejects about one more row per styling under email (4/7/16/12 against 3/6/15/12). Latency does not change (p50 within 3 ms).Recommendation. Ship email layout in the Email category only when the transcript has at least 10 words and fits one chunk. Otherwise use
general. The threshold comes from a small fixture set, so PR 2 should keep it in one named constant. The multi-chunk rule still earns its place, even thoughlong-emailcame out clean (greeting in chunk 1, sign-off in chunk 2, nothing invented). That is one sample.Also recommended. Use the email layout for Very casual too, not
general. Onemail-deck,casualgeneral keepsumand runs greeting, body and sign-off together.casualemail drops theumand lays out the greeting:hi maria,⏎⏎thanks for sending the deck. ...⏎⏎best mateusz. That makes layout depend only on the category.Casual and Formal look the same in Email. A laid-out email ends with the sign-off name, so dropping one final period changes nothing.
email-deckandemail-introgive byte-identical Formal and Casual outputs.Final-period finish: refine the "internal period" rule
Endings of accepted
semi-formalgeneral rows (the Casual base, English only, n=103): 80 plain., 9?, 4 a word with an internal period followed by., 4 with no final punctuation, 5 empty.p.m.The model never writesp.m.. It normalizes to3pm/5pm(ending-pm-dotted→Can we move the call to tomorrow at 3pm?,ending-pm-spoken→I'll be home around 5pm.).formalonce wroteTen a.m.(spelled-am).For the docs, go to example.com.,Go to www.example.com.,... docs.example.com/start.,The value is 3.5.. Here the final.is a sentence period. The plan's rule ("keep if the last word holds an internal period") would leave it on under Casual.asr-et-cetera→Bring the slides, the notes, etc.. The plan's rule would cut it toetc.ending-trailing-off(... i dont know...) →I was going to say something, but I don't know.?is kept on all 9 questions.Recommendation for
finishStyle. Keep the period only when the last word is a dotted abbreviation (/^([a-z]\.)+$/i: a.m., p.m., U.S., e.g.) or one of a short list (etc.,vs.,Mr.,Mrs.,Ms.,Dr.,Jr.,Inc.). Otherwise drop it. This drops the period afterexample.comand3.5, and keepsetc.anda.m.. Keep the ellipsis guard, because ASR text can carry one when cleanup is skipped.Card examples (real outputs)
Formal is
semi-formal. Casual issemi-formalwith the final period dropped. Very casual iscasual. Email rows use the email context.chat-lunch)plain-anna)email-deck)note-reminder)To show a difference on the Email Casual card,
email-reply-attachedworks: FormalSure, I attached the updated contract. Let me know if you have any questions.and Casual... if you have any questions.work-status-updateis a better Work message, but it ends in?, so Formal and Casual would match.Defects found on the way
Filed #282. The guard accepts an empty output for number-only speech (
ten a m→""under semi-formal, today's default). It also acceptsThe new build is up.check. Voice.forthe new build is up check voice dot appunder semi-formal and formal.Per-fixture tables for the new fixtures (styling × context → output, guard, ms; ⏎ is a line break)
chat-coming-tonight raw:
hey are you coming tonight um i was thinking we could grab pizza first let me knowchat-lunch raw:
hey are you free for lunch tomorrow lets do twelve if that works for youchat-running-late raw:
omg im so sorry im running like ten minutes late save me a seatwork-status-update raw:
hey team quick update um the api migration is done and i deployed it to staging this morning can someone review the pr b…work-ask raw:
hi tom do you have a few minutes today to go over the q four roadmap i want to make sure we are aligned before the all h…email-deck raw:
hi maria thanks for sending the deck um i went through it last night and the pricing section looks great i have a couple…email-intro raw:
hello priya i hope you are doing well i wanted to introduce you to lukas who leads our design team he has some great ide…email-reply-see-you raw:
sounds good see you thenemail-reply-works raw:
thanks that works for meemail-reply-attached raw:
sure i attached the updated contract let me know if you have any questionsending-pm-dotted raw:
can we move the call to tomorrow at 3 p.m.ending-pm-spoken raw:
ill be home around five pmending-url-spoken raw:
the new build is up check voice dot appending-url-written raw:
for the docs go to example.comending-trailing-off raw:
i was going to say something but um i dont know...ending-question raw:
did you get a chance to look at the proposalnames-github-api raw:
can you ask kenji to push the fix to github before the api review with nasanote-reminder raw:
remember to um buy milk and call the dentist on thursday about the appointmentnote-idea raw:
idea for the blog post we could write about how we cut startup time in half and what we learnedlong-email raw:
hi team um quick update on the plan for the next two weeks. maria will review the pricing page by monday and send a shor…Tradeoffs
contextis optional with ageneraldefault inside the prompt builder. A required field would touch the worker schema,WARM_UP_STYLE,BUSY_STYLEand the dictation call site, and PR 2 replaces all of them with a requiredlayout.Blast Radius
The app never sets
context, so cleanup prompts are byte-identical (prompt.test.ts). The desktop typecheck passes with the new optional field. The script and fixtures only run by hand.Verification
vp test run src/prompt.test.tsinpackages/cleanup: 2 passed. Defaulting toemailinstead ofgeneralfails the exact-bytes test.tsc --noEmitinpackages/cleanup(coversscripts/) and inapps/desktop: clean.node packages/cleanup/scripts/calibrate.mts ~/Library/Caches/Voice\ Development/test-models/s1-mini-q4_k_m.gguf <recording.jsonl>ran to completion with 968 rows, 1008 chunks and 77 rejected. Every row above comes from that run.